package org.KeyCrafter.server;

public class ServerStatistics {
    // 服务器启动时间
    private long startTime;
    // 已处理命令的数量
    private long numCommands;
    // 服务器接到的连接请求数量
    private long numConnections;
    // 已过期的键数量
    private long expiredKeys;
    // 成功查找键的次数
    private long keyspaceHits;
    // 查找键失败的次数
    private long keyspaceMisses;

    // 自增 increment
    public void incrNumCommands() {
        this.numCommands++;
    }

    public void incrNumConnections() {
        this.numConnections++;
    }

    public void incrExpiredKeys() {
        this.expiredKeys++;
    }

    public void incrKeyspaceHits() {
        this.keyspaceHits++;
    }

    public void incrKeyspaceMisses() {
        this.keyspaceMisses++;
    }

    // set
    void setStartTime(long startTime) {
        this.startTime = startTime;
    }


    // get
    public long getStartTime() {
        return startTime;
    }

    public long getNumCommands() {
        return numCommands;
    }

    public long getNumConnections() {
        return numConnections;
    }

    public long getExpiredKeys() {
        return expiredKeys;
    }

    public long getKeyspaceHits() {
        return keyspaceHits;
    }

    public long getKeyspaceMisses() {
        return keyspaceMisses;
    }
}
